home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9104 / lief1.apr < prev    next >
Text File  |  1991-03-04  |  800b  |  34 lines

  1.  
  2.  
  3. Listing 1: 
  4. Caption: Some example code blocks that do not use parameters.
  5.  
  6.    local myblock := { | | qout(mvar) }, mvar := "testing"
  7.    eval(myblock)    // output: "testing"
  8.  
  9.    local myblock := {|| 5000 }
  10.    x := eval(myblock)
  11.    ? x              // output: 5000
  12.  
  13.    local myblock := { | | x++ }
  14.    for y := 1 to 100
  15.      eval(myblock) // crashes because X not defined
  16.    next
  17.    ? x
  18.  
  19.    local myblock := { | | x++ }, x := 1  // much nicer thanks
  20.    for y := 1 to 100
  21.       eval(myblock)
  22.    next
  23.    ? x              // output: 101
  24.  
  25.    local myblock := { | | BlueFunc() }
  26.    eval(myblock)   // calls BlueFunc() which displays a message
  27.    return nil
  28.  
  29.    static function bluefunc
  30.    ? "here we are in a BlueFunc() - will we ever escape?"
  31.    inkey(5)
  32.    return nil
  33.  
  34.